<template>
  <van-config-provider theme="white">
    <router-view></router-view>
  </van-config-provider>
</template>
<script setup>
import { onBeforeUnmount, onMounted } from "vue";
import { useStore } from "@/stores/index.js";
import { getUserGeolocation } from '@/api/tool.js';

const store = useStore();

async function Geolocation () {
  try {
    const Geolocation = await getUserGeolocation();
    console.log("获取到用户位置：", Geolocation);
    console.log("经纬度：", Geolocation.latitude, Geolocation.longitude);
  } catch (error) {
    console.error("获取位置失败:", error);  //  关键：打印错误信息
  }
}




onMounted(async () => {
  store.$reset()
  console.log("Geolocation:");
  await Geolocation();

})

onBeforeUnmount(() => {
  store.$reset()
});



</script>



<style>
body {
  margin: 0;
  overflow-x: hidden;
  background-color: #f4f4f4;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
</style>
